
public class StaticCouter {
	
	
	static StaticCouter readCouter, wCouter;
	static{
		readCouter = new StaticCouter();
		wCouter = new StaticCouter();
		readCouter.setName("reads ");
		wCouter.setName("$$$$$$$$$$$$$$$$ write ");
	}
	
	int count = 0;
	long val = 0;
	Boolean lock = true;
	String name;
	
	
	public void add(long time){
		synchronized (lock) {
			count++;
			val += time;
			
		}
		System.out.println(name+ " mean: " +  val / count);
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public static StaticCouter getReadCouter() {
		return readCouter;
	};
	
	public static StaticCouter getwCouter() {
		return wCouter;
	};
}
